package com.thwcompany.rabbitMQ.listener;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * Created by IntelliJ IDEA2021.3
 *
 * @Author: Tenghw
 * @Date: 2022/10/24  15:41
 * @Description:
 */
@SuppressWarnings("all")
@Component
@RabbitListener(queues = "direct-pmc-queue")
public class PmcListener2 {
    //发布-订阅模式，这里配置消费者2号监听消息队列direct-pmc-queue
    @RabbitHandler
    public void displayMail(String msg , Channel channel, Message message) throws Exception {
        System.out.println("direct消费者2号，从direct-pmc-queue消息队列监听到的消息是："+msg);
    }
}
